MuleSoft Accelerator for Retail
OFBiz setup and configuration
Apache OFBiz is an OpenSource OMS solution.
Prerequisites
The following components are required in order to set up and configure OFBiz:
- JDK
- Gradle
- A base installation of OFBiz
OFBiz Configuration
The following steps are required in order to configure OFBiz for use by the Accelerator assets.
It is recommended to create a separate service account for integration purposes
- e.g.,
gradle loadAdminUserLogin -PuserLoginId=integrationadmin
- e.g.,
Edit the
framework/security/config/security.propertiesfile and add the OFBiz server hostname to thehost-headers-allowedsettingServices must be exported in order for the Mule applications to be able to invoke them. These are defined in a services
xmlfile under theservicedeffolder, organized by domain. For each of the following services, add the attributeexport="true"to the service definition tag (all file paths are relative to$OFBIZ_HOME/applications):
| Path | Object |
|---|---|
| party/servicedef/services.xml | createPartyPostalAddress quickCreateCustomer createPerson updatePerson createUpdatePartyEmailAddress createUpdatePartyTeleco Number createUpdatePartyPostalAddress findPartiesById |
| party/servicedef/services_view.xml | getPerson getPartiesFromExternalId getPartiesFromExactEmail getPartyContactMechValueMaps |
| accounting/servicedef/services_paymentmethod.xml | createCreditCard |
| order/servicedef/services.xml | addOrderItemShipGroup changeOrderStatus createOrderPaymentPreference findOrders storeOrder |
| product/servicedef/services_shipment.xml | createShipment |
The service names can be cross-referenced with the XML request templates under src/main/resources/ofbiz as well as a few of the Transform Message processors contained in the flows.
The Order, Party, and Product entities must be customized to support the order, customer, and product sync process, respectively. Here are the steps:
Navigate to
$OFBIZ_HOME/applications/datamodel/entitydefMake a backup copies of the
order-entitymodel.xml,party-entitymodel.xml, andpartyproduct-entitymodel.xmlfilesEdit the
order-entitymodel.xmlfile as follows:- Change the type of the externalId field in the OrderItem entity to "name" instead of "id"
- Do the same for the externalId field in the OrderHeader entity
Edit the
party-entitymodel.xmlfile as follows:- Change the type of the externalId field in the Party entity to "name" instead of "id"
- Add the following field to the Person entity:
<field name="customerNumber" type="name"></field>
Edit the
product-entitymodel.xmlfile as follows:- Add the following field to the Product entity:
<field name="externalId" type="name"></field>
- Add the following field to the Product entity:
Save all the files and restart OFBiz if it's already running
Starting OFBiz
Change directory to the OFBiz installation root
Run
nohup gradle ofbiz &- You can add the tail
-f nohup.outto see the console output
- You can add the tail
Open a browser and navigate to
<ofbizhost>:8443/accounting/control/mainUse the default administrative username
adminon the account
Stopping OFBiz
Change directory to the OFBiz installation root
Run
gradle 'ofbiz --shutdown'- Wait for it to shut down cleanly
Troubleshooting
If you see column-constraint errors it is possible the OrderItem.external_id and/or Party.external_id column did not get altered properly. To correct this, install the Apache Derby tools (e.g., sudo apt-get install derby-tools) and run the following commands. Be sure to shut down OFBiz first:
$ ijij> connect 'jdbc:derby:/opt/ofbiz/runtime/data/derby/ofbiz' user 'ofbiz' password 'ofbiz';ij> alter table Party alter column external_Id set data type varchar(100);ij> alter table Order_Item alter column external_Id set data type varchar(100);ij> alter table Order_Header alter column external_Id set data type varchar(100);ij> exit;
Restart OFBiz to pick up the change.